package com.tang.pojo;

public class Book {
    private int id;
    private String name;
    private String author;
    private int stock;
    private double price;
    private int sale;
    private String imgPath;
    public Book(){

    }
    public Book(int id, String name, String author, int stock, double price, int sale, String imgPath) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.stock = stock;
        this.price = price;
        this.sale = sale;
        if(this.imgPath==null||this.imgPath.equals("")){
            this.imgPath = imgPath;
        }

    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public int getStock() {
        return stock;
    }
    public void setStock(int stock) {
        this.stock = stock;
    }
    public double getPrice() {
        return price;
    }
    public void setPrice(double price) {
        this.price = price;
    }
    public int getSale() {
        return sale;
    }
    public void setSale(int sale) {
        this.sale = sale;
    }
    public String getImgPath() {
        return imgPath;
    }
    public void setImgPath(String imgPath) {
        if(this.imgPath==null||this.imgPath.equals("")){
            this.imgPath = imgPath;
        }
    }
    @Override
    public String toString() {
        return
                "id:" + id +"\n"+
                "书名:" + name + "\n" +
                "作者:" + author + "\n" +
                "库存:" + stock +"\n"+
                "价格:" + price +"\n"+
                "销量:" + sale +"\n"+
                "图片路径:" + imgPath
                ;
    }
}
